<!DOCTYPE html>
<html lang="en" class="no-js" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="layout">
<head>
<title>商品通用信息管理</title>

</head>
<body>
<div layout:fragment="content">

	<div class="row">
		<div class="col-md-12">
			<div class="btn-group pull-right">
				<a href="index.html" th:href="@{/goods/brandgeneralinfo/index}" id="link_cancel" class="btn green">返回<i class="fa fa-arrow-circle-o-left"></i></a>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-md-12">
			<div class="form">
				<form role="form" id="form_brandgeneralinfo_edit" th:action="@{/goods/brandgeneralinfo/save}" th:object="${brandGeneralInfo}" method="post" class="form-horizontal">
					<h4 class="form-section">品牌通用信息</h4>
					<input id="hidden_id" type="hidden" th:field="*{id}" />
					<div class="form-body">

						<div class="form-group">
							<label class="control-label col-md-3">品牌名称</label>
							<div class="col-md-4">
					            <select id="selt_brandType" th:field="*{brandId}" th:remove="all-but-first" class="form-control">
					                <option th:each="eachValue : ${brands}" th:value="${eachValue.id}" th:text="${eachValue.name}"></option>
					            </select>													
							</div>
						</div>
						
						<div class="form-group" th:class="${#fields.hasErrors('startDate')}? 'form-group has-error' : 'form-group'">
                            <label class="control-label col-md-3">开始时间<span class="required" aria-required="true">* </span></label>
                            <div class="col-md-4">
                                <input id="text_startDate" th:field="*{startDate}" class="form-control" type="text"></input>
                                <span class="help-block" th:if="${#fields.hasErrors('startDate')}" th:errors="*{startDate}">请输入开始时间</span>
                            </div>
						</div>
						
						<div class="form-group" th:class="${#fields.hasErrors('endDate')}? 'form-group has-error' : 'form-group'">
						    <label class="control-label col-md-3">结束时间<span class="required" aria-required="true">* </span></label>
							<div class="col-md-4">
								<input id="text_endDate" th:field="*{endDate}" data-format="yyyy-MM-dd hh:mm:ss" class="form-control" type="text"></input>
								<span class="help-block" th:if="${#fields.hasErrors('endDate')}" th:errors="*{endDate}">请输入结束时间</span>
							</div>
						</div>
						
						<div class="form-group">
							<label class="control-label col-md-3">是否显示</label>
							<div class="col-md-4">
								<div class="radio-list">
									<label class="radio-inline"><span><input id="radio_displayed_1" type="radio" value="1" checked="" th:field="*{displayed}" /></span> 是</label>
									<label class="radio-inline"><span><input id="radio_displayed_2" type="radio" value="0" th:field="*{displayed}" /></span> 否</label>
								</div>						
							</div>
						</div>	
						
						<div class="form-group">
							<label class="control-label col-md-3">内容</label>							
							<div class="col-md-4">
								<textarea id="textarea_content" rows="4" type="text" class="form-control" placeholder="内容" th:field="*{content}" />
							</div>
						</div>	
							
					</div>
					<div class="form-actions fluid">
						<div class="col-md-offset-3 col-md-9">
							<button id="bt_submit" type="submit" class="btn blue">提交</button>
						</div>
					</div>
				</form>		
			</div>
		</div>
	</div>
</div>	
</body>
</html>

 <script th:inline="javascript">
	/*<![CDATA[*/
		$("#text_startDate").click(function(){
			WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
		}).focus(function () {
            WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
        });
		$("#text_endDate").click(function(){
			WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
		}).focus(function () {
            WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
        });
    $(document).ready(function(){
    	if($.browser.mozilla){
			Metronic.alert({'message':'<span style="color:red;">请使用谷歌或者IE浏览器进行多文件的上传，火狐浏览器暂不支持!</span>'});
		}
        $("#form_brandgeneralinfo_edit").validate({
            rules:{
                brandId:{
                    required:true
                },
                startDate:{
                    required:true
                },
                endDate:{
                    required:true
                },
                disPlayed:{
                    required:true
                }

            },
            messages:{
                brandId:{
                    required:"请选择品牌名称"
                },
                startDate:{
                    required:"请输入开始时间"
                },
                endDate:{
                    required:"请输入结束时间"
                },
                disPlayed:{
                    required:"请选择是否显示"
                }
            }
        });
    });

		KindEditor.ready(function(K) {
	       var editor =  K.create('#textarea_content', {
	                uploadJson : '/upload/BRANDGENERALINFO',
	                allowFileManager : false
	     });
	       editor.clickToolbar('multiimage',function(){
	    	   if($.browser.mozilla){
	    		   editor.hideDialog();
	    		   alert('请使用谷歌或者IE浏览器进行多文件的上传，火狐浏览器暂不支持!');
	    		   return false;
	    	   }
	       });


	});
	           
	/*]]>*/
</script>
